import { request } from "@/utils";

// 获取频道列表
export function getChannelListApi() { 
    return request({
        url: '/channels',
        method: 'GET',
    })
}

// 获取文章列表
export function getArticleListApi(params) { 
    return request({
        url: '/mp/articles',
        method: 'GET',
        params
    })
}

//新增文章
export function addArticleApi(data,params=false) { 
    return request({
        url: `/mp/articles?draft=${params}`,
        method: 'POST',
        data
    })
}

//删除文章/mp/articles/{target}
export function deleteArticleApi(id) { 
    return request({
        url: `/mp/articles/${id}`,
        method: 'DELETE',
    })
}

//获取文章详情
export function getArticleDetailApi(id) { 
    return request({
        url: `/mp/articles/${id}`,
        method: 'GET',
    })
}

//编辑文章
export function editArticleApi(data) { 
    return request({
        url: `/mp/articles/${data.id}`,
        method: 'PUT',
        data
    })
}

